<!DOCTYPE html>
<html>
<head>
    <title>派送修改</title>
    <meta charset=utf-8>
    <meta name=viewport content="width=device-width, initial-scale=1">
    <link rel="stylesheet" type="text/css" href="../../../../start/layui/css/layui.css">
    <script type="text/javascript" src="../../../../start/layui/layui.js"></script>

</head>
<body>
    <!--第二部分总体设置-->
    <form class="layui-form" action="">
<hr class="layui-border-cyan">
  <div style="width: 100%;height: 70px;">
    <dd style="text-align-last: center;font-size:16px;">提货核销</dd>
      <dd style="text-align-last: center;font-size:16px;">
          <div class="layui-inline" style="margin-top:10px">
              <label class="layui-form-label">结算单号：</label>
                  <div class="layui-input-inline" style="width:150px;">
                      <input disabled="disabled" type="text" name="costbreakdownId" id="costbreakdownId" autocomplete="off" class="layui-input">
                  </div>
          </div>
      </dd>
</div>
<hr class="layui-border-cyan">

  <div class="layui-row" style="margin-top:10px">
    <div class="layui-col-xs3">
      <div class="grid-demo grid-demo-bg1">
          <div class="layui-inline">
              <label class="layui-form-label">总收金额：</label>
              <div class="layui-input-inline" style="width:160px;">
                  <input  type="text" name="receivables" id="receivables" placeholder="请输入" autocomplete="off" class="layui-input">
              </div>
          </div>
      </div>
    </div>
    <div class="layui-col-xs3">
      <div class="grid-demo"><div class="layui-inline">
                    <label class="layui-form-label">实付金额：</label>
                    <div class="layui-input-inline">
                        <input  type="text" name="realizefee" id="realizefee" placeholder="请输入"  autocomplete="off" class="layui-input">
                    </div>
                </div></div>
    </div>
    <div class="layui-col-xs3">
      <div class="grid-demo grid-demo-bg1"><div class="layui-inline">
                        <label class="layui-form-label">未结清：</label>
                        <div class="layui-input-inline" style="width:160px;">
                            <input  type="text" name="owefee" id="owefee" placeholder="请输入" autocomplete="off" class="layui-input">
                        </div>
                    </div></div>
    </div>
    <div class="layui-col-xs3">
      <div class="grid-demo"><div class="layui-inline">
                        <label class="layui-form-label">支付方式：</label>
                        <div class="layui-input-inline" style="width:160px;">
                            <select lay-search="">
                                <option value="0"></option>
                                <option value="1">公司转账</option>
                                <option value="2">现金支付</option>
                                <option value="3">微信</option>
                                <option value="4">支付宝</option>
                            </select>
                        </div>
                    </div></div>
    </div>
  </div>
  <div class="layui-row" style="margin-top:10px">
    <div class="layui-col-xs12">
      <div class="grid-demo">
            <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit lay-filter="formDemo" style="align-items: center">确定结算</button>
        </div>
    </div>
      </div>
    </div>
  </div>

    </form>
</body>
<script>
    layui.use(['form', 'layedit', 'laydate','table'], function(){
        var form = layui.form
            ,layer = layui.layer
            ,layedit = layui.layedit
            ,laydate = layui.laydate
            ,table = layui.table;
            var $ = layui.jquery;

        $('#realizefee').blur(function(){
            var receivables = $("#receivables").val();
            var realizefee = $("#realizefee").val();
            var owefee = $("#owefee").val();
            if(parseInt(realizefee)<=parseInt(owefee)){
                var price=0;
                price=parseInt(owefee)-parseInt(realizefee);
                $("#owefee").val(price)
            }else {
                alert("应付金额不能大于未付金额");
            }
        })
        //监听提交：提交事件
        form.on('submit(formDemo)', function(data){
            $.ajax({
                type:'post'
                ,url:'../../../../updateVerification'
                ,data:data.field
                ,success:function(obj) {
                    if(obj.length>0){
                        parent.layer.close(1); //再执行关闭
                        //修改成功后刷新父界面
                        window.parent.location.reload();
                    }
                }
            });
            return false;
        });
    });
</script>
</html>